<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%-- 
    JSP Name : pp_100_03.jsp
    Description : 팝업 수정 폼
    author Seung Hun
    since 2012. 8. 7.
    version 1.0
    Modification Information
       since          author              description
    ===========    =============    ===========================
    2012. 8. 7.     Seung Hun     최초 생성
--%>
<%@ include file="/WEB-INF/jsp/co/mn/include/declare.jspf" %>
<%@ include file="/WEB-INF/jsp/co/mn/include/session.jspf" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@ include file="/WEB-INF/jsp/co/mn/include/header.jspf" %>
<script type="text/javaScript" language="javascript">
$(document).ready(function() {    
    /* form validation check */
    onloadCharCheck();
    
    /* Calendar Image View */
    cldrImgDsp();
     
    /* List Page 이동 */
    $("#listButn").bind("click", moveListPage);
    /* Form Submit */
    $("#rgstButn").bind("click", blcSubm);
    /* Form 초기화 */
    $("#cnclButn").bind("click", formIniz);
});

/*
 * 검색의 달력 이미지버튼 출력
 */
function cldrImgDsp() {
    $( "#bulStrtDt" ).datepicker({
        showOn: "button",
        buttonImage: "/img/mng/ico/ico_calendar.gif",
        buttonImageOnly: true
    });

    $( "#bulFnhDt" ).datepicker({
        showOn: "button",
        buttonImage: "/img/mng/ico/ico_calendar.gif",
        buttonImageOnly: true
    });
}

/*
 * 리스트페이지 이동
 */
function moveListPage() {
    $("#hiddenForm").attr('action','/pp_100_01.do').submit();
}

/*
 * Form Submit
 */
function blcSubm() {
    if (!validateForm($("#mainForm"))) {
        return;
    }
    
    if (!isSchrChk($("#titl").val())) {
        alert("[제목] 은 특수문자(!#$%^&*|'<>-;)를 입력할 수 없습니다.");
        $("#titl").focus();
        return;
    }
    
    if (!validateSearchDate($("#bulStrtDt").val(), $("#bulFnhDt").val())) {
        alert("시작일이 종료일보다 클 수 없습니다.");
        return false;
    }
    
    if (document.twe.BodyValue == "<P style=\"FONT-FAMILY: gulim; FONT-SIZE: 9pt\"></P>") {
        alert("[내용] 을 입력해 주세요.");
        return;
    }
    
    $("#mime_contents").val(document.twe.MimeValue());
    $("#mainForm").attr('target','comIframe');
    $("#mainForm").attr('action','/pp_100_06.do');
    $("#mainForm").submit();
}

/*
 * Form 초기화
 */
function formIniz() {
    $("form").each(function(){
       this.reset(); 
    });
    
    document.mainForm.twe.HtmlValue = $("#mime_contents").val();
}
</script>
<script language="JScript" FOR="twe" EVENT="OnControlInit()">
    var form = document.mainForm;
    form.twe.HtmlValue = form.mime_contents.value;
</script>
</head>
<body>
<div id="wrap">

    <!-- top -->
    <%@ include file="/WEB-INF/jsp/co/mn/include/top.jsp" %>
    <!-- top -->

    <!-- container -->
    <div id="container">
    
        <!-- LNB -->
        <%@ include file="/WEB-INF/jsp/co/mn/include/left.jsp" %>
        <!-- LNB -->
        
        <div id="contents">
        
            <!-- location -->
            <%@ include file="/WEB-INF/jsp/co/mn/include/location.jsp" %>
            <!-- location -->
            
            <%-- request --%>
            <form id="hiddenForm" name="hiddenForm" method="post">
                <input type="hidden" id="currentPageNo" name="currentPageNo" value="${rqInfo.currentPageNo }" />
                <input type="hidden" id="srchStrtDt" name="srchStrtDt" value="${rqInfo.srchStrtDt }" />
                <input type="hidden" id="srchFnhDt" name="srchFnhDt" value="${rqInfo.srchFnhDt }" />
                <input type="hidden" id="srchScn" name="srchScn" value="${rqInfo.srchScn }" />
                <input type="hidden" id="srchTxt" name="srchTxt" value="${rqInfo.srchTxt }" />
            </form>
            
            <p class="msgRequired"><span>*</span>표시는 필수 입력항목입니다</p>
            <form id="mainForm" name="mainForm" method="post" enctype="multipart/form-data">
                <input type="hidden" id="popuIdx" name="popuIdx" value="${result.popuIdx }" />
                <input type="hidden" id="currentPageNo" name="currentPageNo" value="${rqInfo.currentPageNo }" />
                <input type="hidden" id="srchStrtDt" name="srchStrtDt" value="${rqInfo.srchStrtDt }" />
                <input type="hidden" id="srchFnhDt" name="srchFnhDt" value="${rqInfo.srchFnhDt }" />
                <input type="hidden" id="srchScn" name="srchScn" value="${rqInfo.srchScn }" />
                <input type="hidden" id="srchTxt" name="srchTxt" value="${rqInfo.srchTxt }" />
            <table border="1" class="frmTable" summary="팝업관리의 제목,기간,공개여부설정,내용,창크기,창위치를 입력 또는 수정하는 표">
                <col width="25%" />
                <col width="75%" />
                <tbody>
                    <tr>
                        <th><sup>*</sup>기간</th>
                        <td>
                            <div class="dateSearch first">
                                <input type="text" value="${result.bulStrtDt }" id="bulStrtDt" name="bulStrtDt" size="15" readonly="readonly" title="시작일" nullable="true" minbyte="10" maxbyte="10" />
                                ~
                                <input type="text" value="${result.bulFnhDt }" id="bulFnhDt" name="bulFnhDt" size="15" readonly="readonly" title="종료일" nullable="true" minbyte="10" maxbyte="10" />
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <th><sup>*</sup>제목</th>
                        <td><input type="text" title="제목" maxlength="200" id="titl" name="titl" value="${result.titl }" nullable="true" minbyte="1" /></td>
                    </tr>
                    <tr>
                        <th ><sup>*</sup>공개여부설정</th>
                        <td>
                            <select id="oppbYn" name="oppbYn">
                                <option value="N" <c:if test="${rqInfo.oppbYn == 'N' }"><c:out value="selected" /></c:if>>비공개</option>
                                <option value="Y" <c:if test="${rqInfo.oppbYn == 'Y' }"><c:out value="selected" /></c:if>>공개</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th>첨부파일</th>
                        <td>
                            <div class="imgUpload">
                                <p><able:file name="attcFile" fixed="true" filename="" maxsize="30" sizeunit="M" sub="common" classType=""/></p>
                            </div>
                            <c:if test="${result.filNm != null }">
                            <div style="padding-top:5px;"><a href="#" onclick="getUpFileDownload('0040','${result.popuIdx }');return false;">${result.filNm }</a></div>
                            </c:if>
                        </td> 
                    </tr>
                    <tr>
                        <th><sup>*</sup>내용</th>
                        <td>
                            <input type="hidden" id="mime_contents" name="mime_contents" title="내용" value="${result.sbc }" />
                            <script language="jscript" src="/editor/tweditor.js"></script>
                        </td>
                    </tr>
                        <th><sup>*</sup>창크기</th>
                        <td>
                            <div class="frmPopWrap">
                                <span>Width: <input type="text" value="${result.wdthVal }" class="frmPop" id="wdthVal" name="wdthVal" title="창크기" maxlength="8" nullable="true" minbyte="1" maxbyte="8" chartype="onlynum" /></span>
                                <span>Height: <input type="text" value="${result.highVal }" class="frmPop" id="highVal" name="highVal" title="창크기" maxlength="8" nullable="true" minbyte="1" maxbyte="8" chartype="onlynum" /></span>
                            </div>
                        </td>
                    </tr>
                    </tr>
                        <th><sup>*</sup>창위치</th>
                        <td>
                            <div class="frmPopWrap">
                                <span>X: <input type="text" value="${result.xPvt }" class="frmPop" id="xPvt" name="xPvt" title="창위치" maxlength="8" nullable="true" minbyte="1" maxbyte="8" chartype="onlynum" /></span>
                                <span>Y: <input type="text" value="${result.yPvt }" class="frmPop" id="yPvt" name="yPvt" title="창위치" maxlength="8" nullable="true" minbyte="1" maxbyte="8" chartype="onlynum" /></span>
                            </div>
                        </td>
                    </tr>
                </tbody>
            </table>
            </form>
            <div class="btnBoard">
                <span class="flow">
                    <input type="submit" id="listButn" title="목록" value="목록" />
                </span>
                <span class="reverse">
                    <input type="submit" id="rgstButn" title="등록" value="등록" />
                    <input type="submit" id="cnclButn" title="취소" value="취소" />
                </span>
            </div>
        </div>
    </div>
    <!-- /container -->

    <!-- footer -->
    <%@ include file="/WEB-INF/jsp/co/mn/include/bottom.jsp" %>
    <!-- /footer -->
    
</div>
</body>
</html>